using System.Collections.Generic;
using Voodoo.Sauce.Internal.Analytics;

namespace Voodoo.Meta
{
	public class LeaderboardAnalytics
	{
		private readonly LeaderboardRankLogic _rankLogic;

		public LeaderboardAnalytics(LeaderboardRankLogic rankLogic)
		{
			_rankLogic = rankLogic;
		}

		public void SendShowLeaderboardEvent()
		{
			SendEvent("show_leaderboard");
		}

		public void SendHideLeaderboardEvent()
		{
			SendEvent("hide_leaderboard");
		}

		private void SendEvent(string eventName)
		{
			new Dictionary<string, object>
			{
				{
					"level_number",
					AnalyticsStorageHelper.Instance.GetCurrentLevel()
				},
				{
					"game_count",
					AnalyticsStorageHelper.Instance.GetGameCount().ToString()
				},
				{ "previous_rank", _rankLogic.PreviousRank },
				{ "new_rank", _rankLogic.NewRank }
			};
		}
	}
}
